Repetier-Firmware  1.0.0
DisplayList.h
Go to the documentation of this file.
1 /*
2 This file is part of Repetier-Firmware.
3 
4 Repetier-Firmware is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 
9 Repetier-Firmware is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with Repetier-Firmware. If not, see <http://www.gnu.org/licenses/>.
16 
17 This firmware is a nearly complete rewrite of the sprinter firmware
18 by kliment (https://github.com/kliment/Sprinter)
19 which based on Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
20 */
21 #ifndef RF_DISPLAY
22 #define RF_DISPLAY
23 
24 
25 #if FEATURE_CONTROLLER == UICONFIG_CONTROLLER
26 #include "uiconfig.h"
27 #endif
28 // No controller at all
29 #if FEATURE_CONTROLLER == NO_CONTROLLER
30 #define UI_HAS_KEYS 0
31 #define UI_DISPLAY_TYPE NO_DISPLAY
32 #ifdef UI_MAIN
33 void uiInitKeys() {}
34 void uiCheckKeys(uint16_t &action) {}
35 inline void uiCheckSlowEncoder() {}
36 void uiCheckSlowKeys(uint16_t &action) {}
37 #endif // UI_MAIN
38 #endif // NO_CONTROLLER
39 
40 #if (FEATURE_CONTROLLER == CONTROLLER_SMARTRAMPS) || (FEATURE_CONTROLLER == CONTROLLER_GADGETS3D_SHIELD) || (FEATURE_CONTROLLER == CONTROLLER_REPRAPDISCOUNT_GLCD) || (FEATURE_CONTROLLER == CONTROLLER_BAM_DICE_DUE) || (FEATURE_CONTROLLER == CONTROLLER_REPRAPWORLD_GLCD)
41 #define UI_HAS_KEYS 1
42 #define UI_HAS_BACK_KEY 0
43 #if FEATURE_CONTROLLER == CONTROLLER_REPRAPDISCOUNT_GLCD || (FEATURE_CONTROLLER == CONTROLLER_REPRAPWORLD_GLCD)
44 #define UI_DISPLAY_TYPE DISPLAY_U8G
45 #define U8GLIB_ST7920
46 #define UI_LCD_WIDTH 128
47 #define UI_LCD_HEIGHT 64
48 //select font size
49 #define UI_FONT_6X10 //default font
50 #ifdef UI_FONT_6X10
51 #define UI_FONT_WIDTH 6
52 #define UI_FONT_HEIGHT 10
53 #define UI_FONT_SMALL_HEIGHT 7
54 #define UI_FONT_DEFAULT repetier_6x10
55 #define UI_FONT_SMALL repetier_5x7
56 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
57 #endif
58 
59 //calculate rows and cols available with current font
60 #define UI_COLS (UI_LCD_WIDTH/UI_FONT_SMALL_WIDTH)
61 #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
62 #define UI_DISPLAY_CHARSET 3
63 #else // 40x4 char display
64 #define UI_DISPLAY_TYPE DISPLAY_4BIT
65 #define UI_DISPLAY_CHARSET 1
66 #define UI_COLS 20
67 #define UI_ROWS 4
68 #endif
69 
70 #define BEEPER_TYPE 1
71 
72 #if FEATURE_CONTROLLER == CONTROLLER_GADGETS3D_SHIELD // Gadgets3d shield
73 
74 #undef BEEPER_PIN
75 #define BEEPER_PIN 33
76 #define UI_DISPLAY_RS_PIN 16
77 #define UI_DISPLAY_RW_PIN -1
78 #define UI_DISPLAY_ENABLE_PIN 17
79 #define UI_DISPLAY_D0_PIN 23
80 #define UI_DISPLAY_D1_PIN 25
81 #define UI_DISPLAY_D2_PIN 27
82 #define UI_DISPLAY_D3_PIN 29
83 #define UI_DISPLAY_D4_PIN 23
84 #define UI_DISPLAY_D5_PIN 25
85 #define UI_DISPLAY_D6_PIN 27
86 #define UI_DISPLAY_D7_PIN 29
87 #define UI_ENCODER_A 35
88 #define UI_ENCODER_B 37
89 #define UI_ENCODER_CLICK 31
90 #define UI_RESET_PIN 41
91 #else // Smartcontroller
92 
93 #if MOTHERBOARD == 701 // Megatronics v2.0
94 
95 #define UI_DISPLAY_RS_PIN 14
96 #define UI_DISPLAY_RW_PIN -1
97 #define UI_DISPLAY_ENABLE_PIN 15
98 #define UI_DISPLAY_D0_PIN -1
99 #define UI_DISPLAY_D1_PIN -1
100 #define UI_DISPLAY_D2_PIN -1
101 #define UI_DISPLAY_D3_PIN -1
102 #define UI_DISPLAY_D4_PIN 30
103 #define UI_DISPLAY_D5_PIN 31
104 #define UI_DISPLAY_D6_PIN 32
105 #define UI_DISPLAY_D7_PIN 33
106 #define UI_ENCODER_A 61
107 #define UI_ENCODER_B 59
108 #define UI_ENCODER_CLICK 43
109 #define UI_RESET_PIN 66 // was 41 //AE3 was here and added this line 1/25/2014 (Note pin 41 is Y- endstop!)
110 #define UI_INVERT_MENU_DIRECTION 1
111 
112 #elif MOTHERBOARD == 703 // Megatronics v3.0
113 
114 #define UI_DISPLAY_RS_PIN 32
115 #define UI_DISPLAY_RW_PIN -1
116 #define UI_DISPLAY_ENABLE_PIN 31
117 #define UI_DISPLAY_D0_PIN -1
118 #define UI_DISPLAY_D1_PIN -1
119 #define UI_DISPLAY_D2_PIN -1
120 #define UI_DISPLAY_D3_PIN -1
121 #define UI_DISPLAY_D4_PIN 14
122 #define UI_DISPLAY_D5_PIN 30
123 #define UI_DISPLAY_D6_PIN 39
124 #define UI_DISPLAY_D7_PIN 15
125 #define UI_ENCODER_A 45
126 #define UI_ENCODER_B 44
127 #define UI_ENCODER_CLICK 33
128 #define UI_INVERT_MENU_DIRECTION 1
129 #define UI_RESET_PIN -1
130 
131 #elif MOTHERBOARD == 80 // Rumba has different pins as RAMPS!
132 
133 #undef BEEPER_PIN
134 #define BEEPER_PIN 44
135 #define UI_DISPLAY_RS_PIN 19
136 #define UI_DISPLAY_RW_PIN -1
137 #define UI_DISPLAY_ENABLE_PIN 42
138 #define UI_DISPLAY_D0_PIN -1
139 #define UI_DISPLAY_D1_PIN -1
140 #define UI_DISPLAY_D2_PIN -1
141 #define UI_DISPLAY_D3_PIN -1
142 #define UI_DISPLAY_D4_PIN 18
143 #define UI_DISPLAY_D5_PIN 38
144 #define UI_DISPLAY_D6_PIN 41
145 #define UI_DISPLAY_D7_PIN 40
146 #define UI_ENCODER_A 12
147 #define UI_ENCODER_B 11
148 #define UI_ENCODER_CLICK 43
149 #define UI_RESET_PIN 46
150 
151 #elif MOTHERBOARD == 37 // UltiMaker 1.5.7
152 #undef BEEPER_PIN
153 #define BEEPER_PIN 18
154 #define UI_DISPLAY_RS_PIN 20
155 #define UI_DISPLAY_RW_PIN -1
156 #define UI_DISPLAY_ENABLE_PIN 17
157 #define UI_DISPLAY_D0_PIN -1
158 #define UI_DISPLAY_D1_PIN -1
159 #define UI_DISPLAY_D2_PIN -1
160 #define UI_DISPLAY_D3_PIN -1
161 #define UI_DISPLAY_D4_PIN 16
162 #define UI_DISPLAY_D5_PIN 21
163 #define UI_DISPLAY_D6_PIN 5
164 #define UI_DISPLAY_D7_PIN 6
165 #define UI_ENCODER_A 42
166 #define UI_ENCODER_B 40
167 #define UI_ENCODER_CLICK 19
168 #define UI_RESET_PIN -1
169 
170 #elif MOTHERBOARD == 301 // Rambo has own pins layout
171 
172 #undef BEEPER_PIN
173 #define BEEPER_PIN 79
174 #define UI_DISPLAY_RS_PIN 70
175 #define UI_DISPLAY_RW_PIN -1
176 #define UI_DISPLAY_ENABLE_PIN 71
177 #define UI_DISPLAY_D0_PIN -1
178 #define UI_DISPLAY_D1_PIN -1
179 #define UI_DISPLAY_D2_PIN -1
180 #define UI_DISPLAY_D3_PIN -1
181 #define UI_DISPLAY_D4_PIN 72
182 #define UI_DISPLAY_D5_PIN 73
183 #define UI_DISPLAY_D6_PIN 74
184 #define UI_DISPLAY_D7_PIN 75
185 #define UI_ENCODER_A 76
186 #define UI_ENCODER_B 77
187 #define UI_ENCODER_CLICK 78
188 #define UI_RESET_PIN 80
189 #undef SDCARDDETECT
190 #define SDCARDDETECT 81
191 #undef SDCARDDETECTINVERTED
192 #define SDCARDDETECTINVERTED 0
193 #undef SDSUPPORT
194 #define SDSUPPORT 1
195 
196 #elif MOTHERBOARD == 501 // Alligator has own pins layout
197 
198 #undef BEEPER_PIN
199 #define BEEPER_PIN 64
200 #define UI_DISPLAY_RS_PIN 18
201 #define UI_DISPLAY_ENABLE_PIN 15
202 #define UI_DISPLAY_D4_PIN 19
203 #define UI_ENCODER_A 14
204 #define UI_ENCODER_B 16
205 #define UI_ENCODER_CLICK 17
206 #define UI_RESET_PIN -1
207 #undef SDCARDDETECT
208 #define SDCARDDETECT 87
209 #undef SDCARDDETECTINVERTED
210 #define SDCARDDETECTINVERTED 0
211 #ifndef UI_VOLTAGE_LEVEL
212 #define UI_VOLTAGE_LEVEL 1 // Set 1=5 o 0=3.3 V
213 #endif
214 
215 #elif ((MOTHERBOARD == 410) || (MOTHERBOARD == 411)) // DUE3DOM / DUE3DOM MINI has own pins layout
216 
217 #undef BEEPER_PIN
218 #define BEEPER_PIN 41
219 #define UI_DISPLAY_RS_PIN 42
220 #define UI_DISPLAY_ENABLE_PIN 43
221 #define UI_DISPLAY_D4_PIN 44
222 #define UI_DISPLAY_D5_PIN 45
223 #define UI_DISPLAY_D6_PIN 46
224 #define UI_DISPLAY_D7_PIN 47
225 #define UI_ENCODER_A 52
226 #define UI_ENCODER_B 50
227 #define UI_ENCODER_CLICK 48
228 #define UI_RESET_PIN -1
229 #undef SDCARDDETECT
230 #define SDCARDDETECT 14
231 #undef SDCARDDETECTINVERTED
232 #define SDCARDDETECTINVERTED 0
233 #ifndef UI_VOLTAGE_LEVEL
234 #define UI_VOLTAGE_LEVEL 1 // Set 1=5 o 0=3.3 V
235 #endif
236 
237 #elif MOTHERBOARD == 405 // Felix Pro 1
238 
239 #undef BEEPER_PIN
240 #define BEEPER_PIN -1
241 #define UI_DISPLAY_RS_PIN 42
242 #define UI_DISPLAY_ENABLE_PIN 44
243 #define UI_DISPLAY_D4_PIN 43
244 #define UI_ENCODER_A 52
245 #define UI_ENCODER_B 50
246 #define UI_ENCODER_CLICK 48
247 #define UI_RESET_PIN -1
248 
249 #elif MOTHERBOARD == 101 // Felix Pro 1
250 
251 #undef BEEPER_PIN
252 #define BEEPER_PIN -1
253 #define UI_DISPLAY_RS_PIN 16
254 #define UI_DISPLAY_ENABLE_PIN 17
255 #define UI_DISPLAY_D4_PIN 23
256 #define UI_ENCODER_A 35
257 #define UI_ENCODER_B 37
258 #define UI_ENCODER_CLICK 31
259 #define UI_RESET_PIN -1
260 
261 #elif ( MOTHERBOARD == 183 ) || ( MOTHERBOARD == 184 ) // MJRice Pica
262 
263 #undef BEEPER_PIN
264 #define BEEPER_PIN 19
265 #define UI_DISPLAY_RS_PIN 33
266 #define UI_DISPLAY_RW_PIN -1
267 #define UI_DISPLAY_ENABLE_PIN 30
268 #define UI_DISPLAY_D0_PIN -1
269 #define UI_DISPLAY_D1_PIN -1
270 #define UI_DISPLAY_D2_PIN -1
271 #define UI_DISPLAY_D3_PIN -1
272 #define UI_DISPLAY_D4_PIN 35
273 #define UI_DISPLAY_D5_PIN 32
274 #define UI_DISPLAY_D6_PIN 37
275 #define UI_DISPLAY_D7_PIN 36
276 #define UI_ENCODER_A 47
277 #define UI_ENCODER_B 48
278 #define UI_ENCODER_CLICK 31
279 #define UI_RESET_PIN -1
280 #define SDCARDDETECT 49
281 
282 #elif ((MOTHERBOARD == 409)) // Ultratronics
283 
284 #undef BEEPER_PIN
285 #define BEEPER_PIN 27
286 #define UI_DISPLAY_RS_PIN 62
287 #define UI_DISPLAY_ENABLE_PIN 75
288 #define UI_DISPLAY_D4_PIN 76
289 #define UI_DISPLAY_D5_PIN -1
290 #define UI_DISPLAY_D6_PIN -1
291 #define UI_DISPLAY_D7_PIN -1
292 #define UI_ENCODER_A 20
293 #define UI_ENCODER_B 21
294 #define UI_ENCODER_CLICK 64
295 #define UI_RESET_PIN -1
296 #undef SDCARDDETECT
297 #define SDCARDDETECT 60
298 #undef SDCARDDETECTINVERTED
299 #define SDCARDDETECTINVERTED 0
300 
301 #else // RAMPS
302 #undef BEEPER_PIN
303 #define BEEPER_PIN 37
304 #define UI_DISPLAY_RS_PIN 16
305 #define UI_DISPLAY_RW_PIN -1
306 #define UI_DISPLAY_ENABLE_PIN 17
307 #define UI_DISPLAY_D0_PIN 23
308 #define UI_DISPLAY_D1_PIN 25
309 #define UI_DISPLAY_D2_PIN 27
310 #define UI_DISPLAY_D3_PIN 29
311 #define UI_DISPLAY_D4_PIN 23
312 #define UI_DISPLAY_D5_PIN 25
313 #define UI_DISPLAY_D6_PIN 27
314 #define UI_DISPLAY_D7_PIN 29
315 #define UI_ENCODER_A 33
316 #define UI_ENCODER_B 31
317 #define UI_ENCODER_CLICK 35
318 #define UI_RESET_PIN 41
319 #endif
320 #endif // smartcontroller
321 #define UI_DELAYPERCHAR 50
322 #if FEATURE_CONTROLLER == CONTROLLER_BAM_DICE_DUE
323 #define UI_ENCODER_SPEED 2
324 #endif
325 #ifndef UI_INVERT_MENU_DIRECTION
326 #define UI_INVERT_MENU_DIRECTION 0
327 #endif
328 
329 #ifdef UI_MAIN
330 void uiInitKeys() {
331  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
332  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin
333 #if UI_RESET_PIN > -1
335 #endif
336 }
337 void uiCheckKeys(uint16_t &action) {
338 #if FEATURE_CONTROLLER == CONTROLLER_BAM_DICE_DUE
339  UI_KEYS_CLICKENCODER_LOW_REV(UI_ENCODER_B, UI_ENCODER_A); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
340 #else
341  UI_KEYS_CLICKENCODER_LOW_REV(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
342 #endif
343  UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK, UI_ACTION_OK); // push button, connects gnd to pin
344 #if UI_RESET_PIN > -1
346 #endif
347 }
348 inline void uiCheckSlowEncoder() {}
349 void uiCheckSlowKeys(uint16_t &action) {}
350 #endif
351 #endif // Controller 2 and 10
352 
353 #if FEATURE_CONTROLLER == CONTROLLER_ADAFRUIT
354 #define UI_HAS_KEYS 1
355 #define UI_HAS_BACK_KEY 1
356 #define UI_DISPLAY_TYPE DISPLAY_I2C
357 #define UI_DISPLAY_CHARSET 1
358 #define UI_COLS 16
359 #define UI_ROWS 2
360 #define UI_DISPLAY_I2C_CHIPTYPE 1
361 #define UI_DISPLAY_I2C_ADDRESS 0x40
362 #define UI_DISPLAY_I2C_OUTPUT_PINS 65504
363 #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
364 #define UI_DISPLAY_I2C_PULLUP 31
365 #define UI_I2C_CLOCKSPEED 400000L
366 #define UI_DISPLAY_RS_PIN _BV(15)
367 #define UI_DISPLAY_RW_PIN _BV(14)
368 #define UI_DISPLAY_ENABLE_PIN _BV(13)
369 #define UI_DISPLAY_D0_PIN _BV(12)
370 #define UI_DISPLAY_D1_PIN _BV(11)
371 #define UI_DISPLAY_D2_PIN _BV(10)
372 #define UI_DISPLAY_D3_PIN _BV(9)
373 #define UI_DISPLAY_D4_PIN _BV(12)
374 #define UI_DISPLAY_D5_PIN _BV(11)
375 #define UI_DISPLAY_D6_PIN _BV(10)
376 #define UI_DISPLAY_D7_PIN _BV(9)
377 #define UI_INVERT_MENU_DIRECTION 1
378 #define UI_HAS_I2C_KEYS
379 #define UI_HAS_I2C_ENCODER 0
380 #define UI_I2C_KEY_ADDRESS 0x40
381 #ifdef UI_MAIN
382 void uiInitKeys() {}
383 void uiCheckKeys(uint16_t &action) {}
384 inline void uiCheckSlowEncoder() {
386  HAL::i2cWrite(0x12); // GIOA
387  HAL::i2cStop();
389  uint16_t keymask = HAL::i2cReadAck();
390  keymask = keymask + (HAL::i2cReadNak() << 8);
391  HAL::i2cStop();
392 }
393 void uiCheckSlowKeys(uint16_t &action) {
395  HAL::i2cWrite(0x12); // GPIOA
396  HAL::i2cStop();
398  uint16_t keymask = HAL::i2cReadAck();
399  keymask = keymask + (HAL::i2cReadNak() << 8);
400  HAL::i2cStop();
402  UI_KEYS_I2C_BUTTON_LOW(8, UI_ACTION_NEXT); // down button
403  UI_KEYS_I2C_BUTTON_LOW(16, UI_ACTION_BACK); // left button
404  UI_KEYS_I2C_BUTTON_LOW(2, UI_ACTION_OK); // right button
406 }
407 #endif
408 #endif // Controller 3
409 
410 #if FEATURE_CONTROLLER == CONTROLLER_FOLTYN
411 #define UI_HAS_KEYS 1
412 #define UI_HAS_BACK_KEY 1
413 #define UI_DISPLAY_TYPE DISPLAY_4BIT
414 #define UI_DISPLAY_CHARSET 2
415 #define UI_COLS 20
416 #define UI_ROWS 4
417 // PINK.1, 88, D_RS
418 #define UI_DISPLAY_RS_PIN 63
419 #define UI_DISPLAY_RW_PIN -1
420 // PINK.3, 86, D_E
421 #define UI_DISPLAY_ENABLE_PIN 65
422 // PINF.5, 92, D_D4
423 #define UI_DISPLAY_D0_PIN 59
424 // PINK.2, 87, D_D5
425 #define UI_DISPLAY_D1_PIN 64
426 // PINL.5, 40, D_D6
427 #define UI_DISPLAY_D2_PIN 44
428 // PINK.4, 85, D_D7
429 #define UI_DISPLAY_D3_PIN 66
430 // PINF.5, 92, D_D4
431 #define UI_DISPLAY_D4_PIN 59
432 // PINK.2, 87, D_D5
433 #define UI_DISPLAY_D5_PIN 64
434 // PINL.5, 40, D_D6
435 #define UI_DISPLAY_D6_PIN 44
436 // PINK.4, 85, D_D7
437 #define UI_DISPLAY_D7_PIN 66
438 #define UI_DELAYPERCHAR 50
439 #define UI_INVERT_MENU_DIRECTION 0
440 #ifdef UI_MAIN
441 void uiInitKeys() {
442  UI_KEYS_INIT_BUTTON_LOW(4); // push button, connects gnd to pin
447 }
448 void uiCheckKeys(uint16_t &action) {
449  UI_KEYS_BUTTON_LOW(4, UI_ACTION_OK); // push button, connects gnd to pin
450  UI_KEYS_BUTTON_LOW(5, UI_ACTION_NEXT); // push button, connects gnd to pin
451  UI_KEYS_BUTTON_LOW(6, UI_ACTION_PREVIOUS); // push button, connects gnd to pin
452  UI_KEYS_BUTTON_LOW(11, UI_ACTION_BACK); // push button, connects gnd to pin
453  UI_KEYS_BUTTON_LOW(42, UI_ACTION_SD_PRINT ); // push button, connects gnd to pin
454 }
455 inline void uiCheckSlowEncoder() {}
456 void uiCheckSlowKeys(uint16_t &action) {}
457 #endif
458 #endif // Controller 4
459 
460 
461 #if FEATURE_CONTROLLER == CONTROLLER_VIKI // Viki Lcd
462 
463 // You need to change these 3 button according to the positions
464 // where you put them into your board!
465 #define UI_ENCODER_A 7
466 #define UI_ENCODER_B 22
467 #define UI_RESET_PIN 32
468 // Set to -1 if you have not connected that pin
469 #define SDCARDDETECT 49
470 #define SDSS 53
471 
472 #undef SDSUPPORT
473 #define SDSUPPORT 1
474 #define SDCARDDETECTINVERTED 0
475 
476 #define UI_HAS_KEYS 1
477 #define UI_HAS_BACK_KEY 1
478 #define UI_DISPLAY_TYPE DISPLAY_I2C
479 #define UI_DISPLAY_CHARSET 1
480 #define UI_COLS 20
481 #define UI_ROWS 4
482 #define UI_DISPLAY_I2C_CHIPTYPE 1
483 #define UI_DISPLAY_I2C_ADDRESS 0x40
484 #define UI_DISPLAY_I2C_OUTPUT_PINS 0xFFE0
485 #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0x01C0 // bits that are high always, for now the 3 viki leds
486 #define UI_DISPLAY_I2C_PULLUP 0x001F
487 #define UI_I2C_CLOCKSPEED 100000L // Note with very long cables make this much smaller, for 2ft cables I found 80000 worked ok
488 
489 #define UI_DISPLAY_RS_PIN _BV(15)
490 #define UI_DISPLAY_RW_PIN _BV(14)
491 #define UI_DISPLAY_ENABLE_PIN _BV(13)
492 #define UI_DISPLAY_D0_PIN _BV(12)
493 #define UI_DISPLAY_D1_PIN _BV(11)
494 #define UI_DISPLAY_D2_PIN _BV(10)
495 #define UI_DISPLAY_D3_PIN _BV(9)
496 #define UI_DISPLAY_D4_PIN _BV(12)
497 #define UI_DISPLAY_D5_PIN _BV(11)
498 #define UI_DISPLAY_D6_PIN _BV(10)
499 #define UI_DISPLAY_D7_PIN _BV(9)
500 
501 
502 #undef BEEPER_PIN
503 #define BEEPER_PIN _BV(5)
504 #define BEEPER_TYPE 2
505 #define BEEPER_ADDRESS UI_DISPLAY_I2C_ADDRESS // I2C address of the chip with the beeper pin
506 #define UI_I2C_HEATBED_LED _BV(8)
507 #define UI_I2C_HOTEND_LED _BV(7)
508 #define UI_I2C_FAN_LED _BV(6)
509 
510 #define UI_INVERT_MENU_DIRECTION 0
511 #define UI_HAS_I2C_KEYS
512 #define UI_HAS_I2C_ENCODER 0
513 #define UI_I2C_KEY_ADDRESS 0x40
514 #ifdef UI_MAIN
515 void uiInitKeys() {
516  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on real pins. Phase is connected with gnd for signals.
518 }
519 void uiCheckKeys(uint16_t &action) {
520  UI_KEYS_CLICKENCODER_LOW_REV(UI_ENCODER_A, UI_ENCODER_B); // click encoder on real pins
522 }
523 inline void uiCheckSlowEncoder() { }// not used in Viki
524 void uiCheckSlowKeys(uint16_t &action) {
526  HAL::i2cWrite(0x12); // GPIOA
527  HAL::i2cStop();
529  unsigned int keymask = HAL::i2cReadAck();
530  keymask = keymask + (HAL::i2cReadNak() << 8);
531  HAL::i2cStop();
534  UI_KEYS_I2C_BUTTON_LOW(16, UI_ACTION_BACK); // left button
536  UI_KEYS_I2C_BUTTON_LOW(1, UI_ACTION_OK); //Select button
537 
538 }
539 #endif
540 #endif // Controller 5
541 
542 #if FEATURE_CONTROLLER == CONTROLLER_MEGATRONIC
543 #define UI_HAS_KEYS 1
544 #define UI_HAS_BACK_KEY 0
545 #define UI_DISPLAY_TYPE DISPLAY_4BIT
546 #define UI_DISPLAY_CHARSET 0
547 #define UI_COLS 20
548 #define UI_ROWS 2
549 
550 #if MOTHERBOARD==701 // Megatronics v2.0
551 #define UI_DISPLAY_RS_PIN 14
552 #define UI_DISPLAY_RW_PIN -1
553 #define UI_DISPLAY_ENABLE_PIN 15
554 #define UI_DISPLAY_D4_PIN 30
555 #define UI_DISPLAY_D5_PIN 31
556 #define UI_DISPLAY_D6_PIN 32
557 #define UI_DISPLAY_D7_PIN 33
558 #define UI_ENCODER_A 61
559 #define UI_ENCODER_B 59
560 #define UI_ENCODER_CLICK 43
561 
562 #define UI_SHIFT_OUT 17
563 #define UI_SHIFT_LD 42
564 #define UI_SHIFT_CLK 63
565 
566 #else // RAMPS 1.4
567 #define UI_DISPLAY_RS_PIN 16
568 #define UI_DISPLAY_RW_PIN -1
569 #define UI_DISPLAY_ENABLE_PIN 17
570 #define UI_DISPLAY_D4_PIN 23
571 #define UI_DISPLAY_D5_PIN 25
572 #define UI_DISPLAY_D6_PIN 27
573 #define UI_DISPLAY_D7_PIN 29
574 #define UI_ENCODER_A 64
575 #define UI_ENCODER_B 59
576 #define UI_ENCODER_CLICK 63
577 
578 #define UI_SHIFT_OUT 40
579 #define UI_SHIFT_LD 42
580 #define UI_SHIFT_CLK 44
581 #endif
582 
583 #define UI_DELAYPERCHAR 50
584 #define UI_INVERT_MENU_DIRECTION 1
585 #ifdef UI_MAIN
586 void uiInitKeys() {
589 
593 
594  WRITE(UI_SHIFT_OUT, HIGH);
595  WRITE(UI_SHIFT_LD, HIGH);
596 }
597 
598 void uiCheckKeys(uint16_t &action) {
601 }
602 
603 inline void uiCheckSlowEncoder() {} // not used
604 
605 void uiCheckSlowKeys(uint16_t &action) {
606 
607  WRITE(UI_SHIFT_LD, LOW);
608  WRITE(UI_SHIFT_LD, HIGH);
609 
610  for (int8_t i = 1; i <= 8; i++) {
611  if (!READ(UI_SHIFT_OUT)) { // pressed button = logical 0 (false)
612  switch (i) {
613  case 1: action = UI_ACTION_Z_DOWN; break; // F3
614  case 2: action = UI_ACTION_Z_UP; break; // F2
615  case 3: action = UI_ACTION_EMERGENCY_STOP; break; // F1
616  case 4: action = UI_ACTION_Y_UP; break; // UP
617  case 5: action = UI_ACTION_X_UP; break; // RIGHT
618  case 6: action = UI_ACTION_HOME_ALL; break; // MID
619  case 7: action = UI_ACTION_Y_DOWN; break; // DOWN
620  case 8: action = UI_ACTION_X_DOWN; break; // LEFT
621  }
622  i = 9; // if button detected, exit "for loop"
623  }
624  WRITE(UI_SHIFT_CLK, HIGH);
625  WRITE(UI_SHIFT_CLK, LOW);
626  }
627 }
628 #endif
629 #endif // Controller 6
630 #if FEATURE_CONTROLLER == CONTROLLER_RADDS
631 #undef SDSS
632 #define SDSS 10
633 #undef SPI_PIN
634 #define SPI_PIN 77
635 #undef SPI_CHAN
636 #define SPI_CHAN 0
637 #define UI_HAS_KEYS 1
638 #define UI_HAS_BACK_KEY 1
639 #define UI_DISPLAY_TYPE DISPLAY_4BIT
640 #define UI_DISPLAY_CHARSET 1
641 #define BEEPER_TYPE 1
642 #define UI_COLS 20
643 #define UI_ROWS 4
644 #undef BEEPER_PIN
645 #define BEEPER_PIN 41
646 #define UI_DISPLAY_RS_PIN 42
647 #define UI_DISPLAY_RW_PIN -1
648 #define UI_DISPLAY_ENABLE_PIN 43
649 #define UI_DISPLAY_D0_PIN 44
650 #define UI_DISPLAY_D1_PIN 45
651 #define UI_DISPLAY_D2_PIN 46
652 #define UI_DISPLAY_D3_PIN 47
653 #define UI_DISPLAY_D4_PIN 44
654 #define UI_DISPLAY_D5_PIN 45
655 #define UI_DISPLAY_D6_PIN 46
656 #define UI_DISPLAY_D7_PIN 47
657 #define UI_ENCODER_A 50
658 #define UI_ENCODER_B 52
659 #define UI_ENCODER_CLICK 48
660 #define UI_RESET_PIN -1
661 #define UI_DELAYPERCHAR 50
662 #define UI_INVERT_MENU_DIRECTION 0
663 #define UI_BUTTON_BACK 71
664 #ifdef UI_MAIN
665 void uiInitKeys() {
666  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
667  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin
669 }
670 void uiCheckKeys(uint16_t &action) {
671  UI_KEYS_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
672  UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK, UI_ACTION_OK); // push button, connects gnd to pin
674 }
675 inline void uiCheckSlowEncoder() {}
676 void uiCheckSlowKeys(uint16_t &action) {}
677 #endif
678 #endif // Controller 7
679 
680 #if FEATURE_CONTROLLER == CONTROLLER_PIBOT20X4 || FEATURE_CONTROLLER == CONTROLLER_PIBOT16X2
681 
682 #define UI_HAS_KEYS 1
683 #define UI_HAS_BACK_KEY 1
684 #define UI_DISPLAY_TYPE DISPLAY_4BIT
685 #define UI_DISPLAY_CHARSET 1
686 #define UI_DELAYPERCHAR 50
687 #define UI_INVERT_MENU_DIRECTION 1
688 #define BEEPER_SHORT_SEQUENCE 6,2 // Needs longer beep sequence
689 #define BEEPER_LONG_SEQUENCE 24,8
690 #define BEEPER_TYPE 1
691 #define BEEPER_TYPE_INVERTING 0
692 
693 #if FEATURE_CONTROLLER == CONTROLLER_PIBOT16X2
694 #define UI_COLS 16
695 #define UI_ROWS 2
696 #else
697 #define UI_COLS 20
698 #define UI_ROWS 4
699 #endif
700 
701 #ifdef PiBot_V_1_4
702 #undef BEEPER_PIN
703 #define BEEPER_PIN 31
704 #define UI_DISPLAY_RS_PIN 45
705 #define UI_DISPLAY_RW_PIN -1
706 #define UI_DISPLAY_ENABLE_PIN 44
707 #define UI_DISPLAY_D0_PIN 43
708 #define UI_DISPLAY_D1_PIN 42
709 #define UI_DISPLAY_D2_PIN 19
710 #define UI_DISPLAY_D3_PIN 18
711 #define UI_DISPLAY_D4_PIN 43
712 #define UI_DISPLAY_D5_PIN 42
713 #define UI_DISPLAY_D6_PIN 19
714 #define UI_DISPLAY_D7_PIN 18
715 #define UI_ENCODER_A 61
716 #define UI_ENCODER_B 62
717 #define UI_ENCODER_CLICK 63
718 #define UI_RESET_PIN 28
719 #define UI_DELAYPERCHAR 50
720 #define UI_BUTTON_OK 49
721 #define UI_BUTTON_NEXT 48
722 #define UI_BUTTON_PREVIOUS 47
723 #define UI_BUTTON_BACK 46
724 #define UI_BUTTON_SD_PRINT 29
725 #endif
726 
727 #if PiBot_V_1_4==true || PiBot_V_1_6==true
728 #undef BEEPER_PIN
729 #define BEEPER_PIN 37
730 #define UI_DISPLAY_RS_PIN 16
731 #define UI_DISPLAY_RW_PIN -1
732 #define UI_DISPLAY_ENABLE_PIN 17
733 #define UI_DISPLAY_D0_PIN 23
734 #define UI_DISPLAY_D1_PIN 25
735 #define UI_DISPLAY_D2_PIN 27
736 #define UI_DISPLAY_D3_PIN 29
737 #define UI_DISPLAY_D4_PIN 23
738 #define UI_DISPLAY_D5_PIN 25
739 #define UI_DISPLAY_D6_PIN 27
740 #define UI_DISPLAY_D7_PIN 29
741 #define UI_ENCODER_A 33
742 #define UI_ENCODER_B 31
743 #define UI_ENCODER_CLICK 35
744 #define UI_RESET_PIN 41
745 #define UI_DELAYPERCHAR 50
746 #define UI_BUTTON_OK 4
747 #define UI_BUTTON_NEXT 6
748 #define UI_BUTTON_PREVIOUS 5
749 #define UI_BUTTON_BACK 11
750 #define UI_BUTTON_SD_PRINT 42
751 #endif
752 
753 #if PiBot_V_2_0
754 #undef BEEPER_PIN
755 #define BEEPER_PIN 16
756 #define UI_DISPLAY_RS_PIN 43
757 #define UI_DISPLAY_RW_PIN -1
758 #define UI_DISPLAY_ENABLE_PIN 42
759 #define UI_DISPLAY_D0_PIN 19
760 #define UI_DISPLAY_D1_PIN 18
761 #define UI_DISPLAY_D2_PIN 38
762 #define UI_DISPLAY_D3_PIN 41
763 #define UI_DISPLAY_D4_PIN 19
764 #define UI_DISPLAY_D5_PIN 18
765 #define UI_DISPLAY_D6_PIN 38
766 #define UI_DISPLAY_D7_PIN 41
767 
768 #define UI_ENCODER_A 37
769 #define UI_ENCODER_B 36
770 // Vick BTN
771 #define UI_ENCODER_CLICK 69
772 // if you want, you can get the CNC Pin used 11
773 #define UI_RESET_PIN -1
774 
775 #define UI_DELAYPERCHAR 320
776 #define UI_BUTTON_OK 47
777 #define UI_BUTTON_NEXT 46
778 #define UI_BUTTON_PREVIOUS 45
779 #define UI_BUTTON_BACK 44
780 // if you want, you can get the CNC Pin used 10
781 #define UI_BUTTON_SD_PRINT 70
782 #endif
783 
784 #ifdef UI_MAIN
785 void uiInitKeys() {
786  UI_KEYS_INIT_BUTTON_LOW(UI_BUTTON_OK); // push button, connects gnd to pin
791 }
792 void uiCheckKeys(uint16_t &action) {
793  UI_KEYS_BUTTON_LOW(UI_BUTTON_OK, UI_ACTION_OK); // push button, connects gnd to pin
794  UI_KEYS_BUTTON_LOW(UI_BUTTON_NEXT, UI_ACTION_NEXT); // push button, connects gnd to pin
795  UI_KEYS_BUTTON_LOW(UI_BUTTON_PREVIOUS, UI_ACTION_PREVIOUS); // push button, connects gnd to pin
796  UI_KEYS_BUTTON_LOW(UI_BUTTON_BACK, UI_ACTION_BACK); // push button, connects gnd to pin
797  UI_KEYS_BUTTON_LOW(UI_BUTTON_SD_PRINT, UI_ACTION_SD_PRINT ); // push button, connects gnd to pin
798 }
799 inline void uiCheckSlowEncoder() {}
800 void uiCheckSlowKeys(uint16_t &action) {}
801 #endif
802 #endif
803 
804 #if FEATURE_CONTROLLER == CONTROLLER_FELIX
805 #define UI_HAS_KEYS 1
806 #define UI_HAS_BACK_KEY 0
807 #define UI_DISPLAY_TYPE DISPLAY_4BIT
808 #define UI_DISPLAY_CHARSET 1
809 #define UI_COLS 20
810 #define UI_ROWS 4
811 #define UI_ENCODER_SPEED 2
812 #undef BEEPER_TYPE
813 #define BEEPER_TYPE 0
814 #undef BEEPER_PIN
815 #define BEEPER_PIN -1
816 #define UI_DISPLAY_RS_PIN 16
817 #define UI_DISPLAY_RW_PIN -1
818 #define UI_DISPLAY_ENABLE_PIN 17
819 #define UI_DISPLAY_D0_PIN -1
820 #define UI_DISPLAY_D1_PIN -1
821 #define UI_DISPLAY_D2_PIN -1
822 #define UI_DISPLAY_D3_PIN -1
823 #define UI_DISPLAY_D4_PIN 23
824 #define UI_DISPLAY_D5_PIN 25
825 #define UI_DISPLAY_D6_PIN 27
826 #define UI_DISPLAY_D7_PIN 29
827 #define UI_ENCODER_A 35
828 #define UI_ENCODER_B 37
829 #define UI_ENCODER_CLICK 31
830 #define UI_DELAYPERCHAR 50
831 #define UI_INVERT_MENU_DIRECTION 0
832 #ifdef UI_MAIN
833 void uiInitKeys() {
834  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
835  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin
836 }
837 void uiCheckKeys(uint16_t &action) {
838  UI_KEYS_CLICKENCODER_LOW_REV(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
839  UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK, UI_ACTION_OK); // push button, connects gnd to pin
840 }
841 inline void uiCheckSlowEncoder() {}
842 void uiCheckSlowKeys(uint16_t &action) {}
843 #endif
844 #endif // Controller 12
845 
846 #if FEATURE_CONTROLLER == CONTROLLER_RAMBO // SeeMeCNC LCD + Rambo
847 #define UI_HAS_KEYS 1
848 #define UI_HAS_BACK_KEY 0
849 #define UI_DISPLAY_TYPE DISPLAY_4BIT
850 #define UI_DISPLAY_CHARSET 1
851 #define UI_COLS 20
852 #define UI_ROWS 4
853 #define BEEPER_TYPE 1
854 #undef BEEPER_PIN
855 #define BEEPER_PIN 79
856 #define UI_DISPLAY_RS_PIN 70
857 #define UI_DISPLAY_RW_PIN -1
858 #define UI_DISPLAY_ENABLE_PIN 71
859 #define UI_DISPLAY_D0_PIN -1
860 #define UI_DISPLAY_D1_PIN -1
861 #define UI_DISPLAY_D2_PIN -1
862 #define UI_DISPLAY_D3_PIN -1
863 #define UI_DISPLAY_D4_PIN 72
864 #define UI_DISPLAY_D5_PIN 73
865 #define UI_DISPLAY_D6_PIN 74
866 #define UI_DISPLAY_D7_PIN 75
867 #define UI_ENCODER_A 76
868 #define UI_ENCODER_B 77
869 #define UI_ENCODER_CLICK 78
870 #define UI_KILL_PIN 80
871 #define UI_DELAYPERCHAR 50
872 #define UI_INVERT_MENU_DIRECTION 0
873 #ifdef UI_MAIN
874 void uiInitKeys() {
878 }
879 void uiCheckKeys(uint16_t &action) {
883 }
884 inline void uiCheckSlowEncoder() {}
885 void uiCheckSlowKeys(uint16_t &action) {}
886 #endif
887 #endif // Controller 13
888 
889 #if FEATURE_CONTROLLER == CONTROLLER_OPENHARDWARE_LCD2004
890 #undef SDSUPPORT
891 #define SDSUPPORT 1
892 #define SDCARDDETECT -1
893 #define UI_HAS_KEYS 1
894 #define UI_HAS_BACK_KEY 1
895 #define UI_DISPLAY_TYPE DISPLAY_I2C
896 #define UI_DISPLAY_CHARSET 1
897 #define UI_COLS 20
898 #define UI_ROWS 4
899 #define UI_DISPLAY_I2C_CHIPTYPE 1
900 #define UI_DISPLAY_I2C_ADDRESS 0x40
901 #define UI_DISPLAY_I2C_OUTPUT_PINS 65504
902 #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
903 #define UI_DISPLAY_I2C_PULLUP 31
904 #define UI_I2C_CLOCKSPEED 400000L
905 #define UI_DISPLAY_RS_PIN _BV(15)
906 #define UI_DISPLAY_RW_PIN _BV(14)
907 #define UI_DISPLAY_ENABLE_PIN _BV(13)
908 #define UI_DISPLAY_D0_PIN _BV(12)
909 #define UI_DISPLAY_D1_PIN _BV(11)
910 #define UI_DISPLAY_D2_PIN _BV(10)
911 #define UI_DISPLAY_D3_PIN _BV(9)
912 #define UI_DISPLAY_D4_PIN _BV(12)
913 #define UI_DISPLAY_D5_PIN _BV(11)
914 #define UI_DISPLAY_D6_PIN _BV(10)
915 #define UI_DISPLAY_D7_PIN _BV(9)
916 #define UI_INVERT_MENU_DIRECTION false
917 #define UI_HAS_I2C_KEYS
918 #define UI_HAS_I2C_ENCODER 0
919 #define UI_I2C_KEY_ADDRESS 0x40
920 
921 #ifdef UI_MAIN
922 void uiInitKeys() {}
923 void uiCheckKeys(uint16_t &action) {}
924 inline void uiCheckSlowEncoder() {
926  HAL::i2cWrite(0x12); // GIOA
927  HAL::i2cStop();
929  uint16_t keymask = HAL::i2cReadAck();
930  keymask = keymask + (HAL::i2cReadNak() << 8);
931  HAL::i2cStop();
932 }
933 void uiCheckSlowKeys(uint16_t &action) {
935  HAL::i2cWrite(0x12); // GPIOA
936  HAL::i2cStop();
938  uint16_t keymask = HAL::i2cReadAck();
939  keymask = keymask + (HAL::i2cReadNak() << 8);
940  HAL::i2cStop();
941  UI_KEYS_I2C_BUTTON_LOW(_BV(4), UI_ACTION_OK); // push button, connects gnd to pin
942  UI_KEYS_I2C_BUTTON_LOW(_BV(1), UI_ACTION_BACK); // push button, connects gnd to pin
943  UI_KEYS_I2C_BUTTON_LOW(_BV(0), UI_ACTION_SD_PRINT); // push button, connects gnd to pin
944  UI_KEYS_I2C_BUTTON_LOW(_BV(3), UI_ACTION_PREVIOUS); // Up button
945  UI_KEYS_I2C_BUTTON_LOW(_BV(2), UI_ACTION_NEXT); // down button
946 }
947 #endif
948 #endif // Controller 14
949 
950 /*
951  Sanguinololu + panelolu2
952 */
953 #if FEATURE_CONTROLLER == CONTROLLER_SANGUINOLOLU_PANELOLU2
954 #define UI_HAS_KEYS 1
955 #define UI_HAS_BACK_KEY 0
956 #define UI_DISPLAY_TYPE DISPLAY_I2C
957 #define UI_DISPLAY_CHARSET 2
958 #define UI_COLS 20
959 #define UI_ROWS 4
960 #define UI_INVERT_MENU_DIRECTION 0
961 
962 #define UI_DISPLAY_I2C_CHIPTYPE 1
963 #define UI_DISPLAY_I2C_ADDRESS 0x40
964 #define UI_DISPLAY_I2C_OUTPUT_PINS 65528
965 #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
966 #define UI_DISPLAY_I2C_PULLUP 23
967 #define UI_I2C_CLOCKSPEED 100000L
968 //#define UI_HAS_I2C_KEYS
969 //#define UI_HAS_I2C_ENCODER 0
970 //#define UI_I2C_KEY_ADDRESS UI_DISPLAY_I2C_ADDRESS
971 #define BEEPER_TYPE 2
972 #define BEEPER_TYPE_INVERTING 1
973 #define BEEPER_ADDRESS UI_DISPLAY_I2C_ADDRESS
974 #define COMPILE_I2C_DRIVER
975 
976 #define UI_DISPLAY_RS_PIN _BV(15)
977 #define UI_DISPLAY_RW_PIN _BV(14)
978 #define UI_DISPLAY_ENABLE_PIN _BV(13)
979 #define UI_DISPLAY_D0_PIN _BV(12)
980 #define UI_DISPLAY_D1_PIN _BV(11)
981 #define UI_DISPLAY_D2_PIN _BV(10)
982 #define UI_DISPLAY_D3_PIN _BV(9)
983 #define UI_DISPLAY_D4_PIN _BV(12)
984 #define UI_DISPLAY_D5_PIN _BV(11)
985 #define UI_DISPLAY_D6_PIN _BV(10)
986 #define UI_DISPLAY_D7_PIN _BV(9)
987 #undef BEEPER_PIN
988 #define BEEPER_PIN _BV(5)
989 #define UI_I2C_HEATBED_LED _BV(8)
990 #define UI_I2C_HOTEND_LED _BV(7)
991 #define UI_I2C_FAN_LED _BV(6)
992 
993 #ifdef UI_MAIN
994 void uiInitKeys() {
995  UI_KEYS_INIT_CLICKENCODER_LOW(10, 11); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
996  UI_KEYS_INIT_BUTTON_LOW(30); // push button, connects gnd to pin
997 }
998 
999 void uiCheckKeys(uint16_t &action) {
1000  UI_KEYS_CLICKENCODER_LOW_REV(10, 11); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1001  UI_KEYS_BUTTON_LOW(30, UI_ACTION_OK); // push button, connects gnd to pin
1002 }
1003 
1004 inline void uiCheckSlowEncoder() {}
1005 
1006 void uiCheckSlowKeys(uint16_t &action) {}
1007 #endif // UI_MAIN
1008 #endif // Controller 15
1009 
1010 #if FEATURE_CONTROLLER == CONTROLLER_GAMEDUINO2
1011 #define UI_HAS_KEYS 1
1012 #define UI_HAS_BACK_KEY 0
1013 #define UI_DISPLAY_TYPE DISPLAY_GAMEDUINO2
1014 #define UI_DISPLAY_CHARSET 0
1015 #define UI_COLS 30
1016 #define UI_ROWS 4
1017 #define UI_INVERT_MENU_DIRECTION 0
1018 
1019 #define BEEPER_TYPE 0
1020 #define BEEPER_TYPE_INVERTING 0
1021 
1022 #define UI_DISPLAY_CS 49 // Pin for SPI select on gameduino 2 - depends on board and choice
1023 
1024 #endif // Controller 16
1025 #if FEATURE_CONTROLLER == CONTROLLER_MIREGLI // Miregli
1026 #define UI_HAS_KEYS 1
1027 #define UI_HAS_BACK_KEY 1
1028 #define UI_DISPLAY_CHARSET 1
1029 #define UI_COLS 20
1030 #define UI_ROWS 4
1031 #define UI_KILL_PIN 76
1032 #define UI_ENCODER_A 80
1033 #define UI_ENCODER_B 73
1034 #define UI_ENCODER_CLICK 63
1035 #define UI_DELAYPERCHAR 50
1036 #define MIREGLI
1037 #define SDCARDDETECT -1 //53
1038 #define BEEPER 78
1039 #define LCD_CONTRAST 62
1040 #define UI_DISPLAY_TYPE 14
1041 #define LCD_PIN_BL 15
1042 #define DOGLCD_A0 38
1043 #define DOGLCD_CS 14
1044 #define UI_LCD_WIDTH 128
1045 #define UI_LCD_HEIGHT 64
1046 #define U8GLIB_ST7920
1047 
1048 #define UI_INVERT_MENU_DIRECTION false
1049 
1050 //select font size
1051 #define UI_FONT_6X10 //default font
1052 #ifdef UI_FONT_6X10
1053 #define UI_FONT_WIDTH 6
1054 #define UI_FONT_HEIGHT 10
1055 #define UI_FONT_SMALL_HEIGHT 7
1056 #define UI_FONT_DEFAULT repetier_6x10
1057 #define UI_FONT_SMALL repetier_5x7
1058 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
1059 #endif
1060 
1061 #ifdef UI_MAIN
1062 void ui_init_keys() {
1066 }
1067 void ui_check_keys(int &action) {
1071 }
1072 inline void ui_check_slow_encoder() {}
1073 void ui_check_slow_keys(int &action) {}
1074 #endif
1075 #endif // Controller 17
1076 #if FEATURE_CONTROLLER == CONTROLLER_GATE_3NOVATICA
1077 #define UI_HAS_KEYS 1
1078 #define UI_HAS_BACK_KEY 0
1079 #define UI_DISPLAY_TYPE DISPLAY_4BIT
1080 #define UI_DISPLAY_CHARSET 1
1081 #define UI_COLS 20
1082 #define UI_ROWS 4
1083 #define BEEPER_TYPE 1
1084 #undef BEEPER_PIN
1085 #define BEEPER_PIN -1
1086 #define UI_DISPLAY_RS_PIN 1
1087 #define UI_DISPLAY_RW_PIN -1
1088 #define UI_DISPLAY_ENABLE_PIN 3
1089 #define UI_DISPLAY_D0_PIN -1
1090 #define UI_DISPLAY_D1_PIN -1
1091 #define UI_DISPLAY_D2_PIN -1
1092 #define UI_DISPLAY_D3_PIN -1
1093 #define UI_DISPLAY_D4_PIN 0
1094 #define UI_DISPLAY_D5_PIN 2
1095 #define UI_DISPLAY_D6_PIN 4
1096 #define UI_DISPLAY_D7_PIN 6
1097 #define UI_ENCODER_A 5
1098 #define UI_ENCODER_B 7
1099 #define UI_ENCODER_CLICK 39
1100 #define UI_KILL_PIN -1
1101 #define UI_DELAYPERCHAR 320 // bylo 50
1102 #define UI_INVERT_MENU_DIRECTION 1 // bylo 0
1103 #define USER_KEY1_PIN 36
1104 #define USER_KEY1_ACTION UI_ACTION_LIGHTS_ONOFF
1105 #define USER_KEY2_PIN 40
1106 #define USER_KEY2_ACTION UI_ACTION_PREHEAT_ALL
1107 #define USER_KEY3_PIN 41
1108 #define USER_KEY3_ACTION UI_ACTION_WIZARD_FILAMENTCHANGE
1109 #define USER_KEY4_PIN -1
1110 #define USER_KEY4_ACTION UI_ACTION_DUMMY
1111 
1112 #ifdef UI_MAIN
1113 void uiInitKeys() {
1116 }
1117 void uiCheckKeys(uint16_t &action) {
1120 }
1121 inline void uiCheckSlowEncoder() {}
1122 void uiCheckSlowKeys(uint16_t &action) {}
1123 #endif
1124 #endif // CONTROLLER_GATE_3NOVATICA
1125 
1126 #if FEATURE_CONTROLLER == CONTROLLER_SPARKLCD || FEATURE_CONTROLLER == CONTROLLER_SPARKLCD_ADAPTER
1127 #if MOTHERBOARD != 402 && MOTHERBOARD != 412
1128 #error This config only works with RADDS motherboard!
1129 #endif
1130 #define UI_DISPLAY_CHARSET 3
1131 #define UI_DISPLAY_TYPE 5
1132 #define U8GLIB_ST7920 // Currently only this display from u8g lib is included.
1133 #define UI_LCD_WIDTH 128
1134 #define UI_LCD_HEIGHT 64
1135 
1136 //select font size
1137 #define UI_FONT_6X10 //default font
1138 #define UI_FONT_WIDTH 6
1139 #define UI_FONT_HEIGHT 10
1140 #define UI_FONT_SMALL_HEIGHT 7
1141 #define UI_FONT_DEFAULT repetier_6x10
1142 #define UI_FONT_SMALL repetier_5x7
1143 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
1144 #define UI_DELAYPERCHAR 50
1145 #define UI_HAS_KEYS 1
1146 #define UI_HAS_BACK_KEY 0
1147 #define UI_INVERT_MENU_DIRECTION 0
1148 #define UI_HAS_I2C_ENCODER 0
1149 #undef UI_ENCODER_SPEED
1150 #define UI_ENCODER_SPEED 2
1151 
1152 //calculate rows and cols available with current font
1153 #define UI_COLS (UI_LCD_WIDTH/UI_FONT_SMALL_WIDTH)
1154 #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
1155 #define UI_DISPLAY_D0_PIN -1
1156 #define UI_DISPLAY_D1_PIN -1
1157 #define UI_DISPLAY_D2_PIN -1
1158 #define UI_DISPLAY_D3_PIN -1
1159 #define UI_DISPLAY_D5_PIN -1
1160 #define UI_DISPLAY_D6_PIN -1
1161 #define UI_DISPLAY_D7_PIN -1
1162 
1163 #if FEATURE_CONTROLLER == CONTROLLER_SPARKLCD
1164 #if MOTHERBOARD == 412 // STACKER 3d Superboard
1165 // PINK.1, 88, D_RS
1166 #define UI_DISPLAY_RS_PIN 29 // 29
1167 #define UI_DISPLAY_RW_PIN -1
1168 // PINK.3, 86, D_E
1169 #define UI_DISPLAY_ENABLE_PIN 27 //25
1170 // PINF.5, 92, D_D4
1171 // PINF.5, 92, D_D4
1172 #define UI_DISPLAY_D4_PIN 25 // 27
1173 #define UI_ENCODER_A 33
1174 #define UI_ENCODER_B 35
1175 #define UI_ENCODER_CLICK 37
1176 #else // MOTHERBOARD == 412
1177 // PINK.1, 88, D_RS
1178 #define UI_DISPLAY_RS_PIN 25
1179 #define UI_DISPLAY_RW_PIN -1
1180 // PINK.3, 86, D_E
1181 #define UI_DISPLAY_ENABLE_PIN 27
1182 // PINF.5, 92, D_D4
1183 // PINF.5, 92, D_D4
1184 #define UI_DISPLAY_D4_PIN 29
1185 #define UI_ENCODER_A 35
1186 #define UI_ENCODER_B 33
1187 #define UI_ENCODER_CLICK 37
1188 #endif
1189 #else // FEATURE_CONTROLLER == CONTROLLER_SPARKLCD
1190 // PINK.1, 88, D_RS
1191 #define UI_DISPLAY_RS_PIN 44
1192 #define UI_DISPLAY_RW_PIN -1
1193 // PINK.3, 86, D_E
1194 #define UI_DISPLAY_ENABLE_PIN 45
1195 #define UI_DISPLAY_D4_PIN 46
1196 #define UI_ENCODER_A 50
1197 #define UI_ENCODER_B 52
1198 #define UI_ENCODER_CLICK 48
1199 #endif
1200 
1201 #ifdef UI_MAIN
1202 void uiInitKeys() {
1203  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1204  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin;
1205 }
1206 void uiCheckKeys(uint16_t &action) {
1207  UI_KEYS_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1208  UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK, UI_ACTION_OK); // push button, connects gnd to pin
1209 }
1210 inline void uiCheckSlowEncoder() {}
1211 void uiCheckSlowKeys(uint16_t &action) {}
1212 #endif
1213 
1214 #endif // CONTROLLER_sparkLCD
1215 
1216 #if FEATURE_CONTROLLER == CONTROLLER_ORCABOTXXLPRO2
1217 #if MOTHERBOARD != 402
1218 #error This config only works with RADDS motherboard!
1219 #endif
1220 #define UI_DISPLAY_CHARSET 3
1221 #define UI_DISPLAY_TYPE 5
1222 #define U8GLIB_ST7920 // Currently only this display from u8g lib is included.
1223 #define UI_LCD_WIDTH 128
1224 #define UI_LCD_HEIGHT 64
1225 
1226 //select font size
1227 #define UI_FONT_6X10 //default font
1228 #define UI_FONT_WIDTH 6
1229 #define UI_FONT_HEIGHT 10
1230 #define UI_FONT_SMALL_HEIGHT 7
1231 #define UI_FONT_DEFAULT repetier_6x10
1232 #define UI_FONT_SMALL repetier_5x7
1233 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
1234 #undef UI_ANIMATION
1235 #define UI_ANIMATION 0 // Animations are too slow
1236 #define UI_DELAYPERCHAR 50
1237 #define UI_HAS_KEYS 1
1238 #define UI_HAS_BACK_KEY 0
1239 #define UI_INVERT_MENU_DIRECTION 0
1240 #define UI_HAS_I2C_ENCODER 0
1241 #define UI_ENCODER_SPEED 1
1242 
1243 //SD Card
1244 #undef SDSS
1245 #define SDSS 10
1246 #undef SPI_PIN
1247 #define SPI_PIN 77
1248 #undef SPI_CHAN
1249 #define SPI_CHAN 0
1250 
1251 //calculate rows and cols available with current font
1252 #define UI_COLS (UI_LCD_WIDTH/UI_FONT_SMALL_WIDTH)
1253 #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
1254 #define UI_DISPLAY_D0_PIN -1
1255 #define UI_DISPLAY_D1_PIN -1
1256 #define UI_DISPLAY_D2_PIN -1
1257 #define UI_DISPLAY_D3_PIN -1
1258 #define UI_DISPLAY_D5_PIN -1
1259 #define UI_DISPLAY_D6_PIN -1
1260 #define UI_DISPLAY_D7_PIN -1
1261 
1262 #define UI_DISPLAY_RS_PIN 44
1263 #define UI_DISPLAY_RW_PIN -1
1264 #define UI_DISPLAY_ENABLE_PIN 45
1265 #define UI_DISPLAY_D4_PIN 46
1266 #define UI_ENCODER_A 50
1267 #define UI_ENCODER_B 52
1268 #define UI_ENCODER_CLICK 48
1269 
1270 #ifdef UI_MAIN
1271 void uiInitKeys() {
1272  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1273  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin;
1274 }
1275 void uiCheckKeys(uint16_t &action) {
1276  UI_KEYS_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1277  UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK, UI_ACTION_OK); // push button, connects gnd to pin
1278 }
1279 inline void uiCheckSlowEncoder() {}
1280 void uiCheckSlowKeys(uint16_t &action) {}
1281 #endif
1282 
1283 #endif // CONTROLLER_ORCABOTXXLPRO2
1284 
1285 
1286 #if FEATURE_CONTROLLER == CONTROLLER_VIKI2
1287 #define UI_HAS_KEYS 1
1288 #define UI_HAS_BACK_KEY 0
1289 #define UI_DISPLAY_TYPE DISPLAY_U8G
1290 //#define U8GLIB_ST7920
1291 #define U8GLIB_ST7565_NHD_C2832_HW_SPI
1292 #define UI_LCD_WIDTH 128
1293 #define UI_LCD_HEIGHT 64
1294 //select font size
1295 #define UI_FONT_6X10 //default font
1296 #define UI_FONT_WIDTH 6
1297 #define UI_FONT_HEIGHT 10
1298 #define UI_FONT_SMALL_HEIGHT 7
1299 #define UI_FONT_DEFAULT repetier_6x10
1300 #define UI_FONT_SMALL repetier_5x7
1301 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
1302 
1303 //calculate rows and cols available with current font
1304 #define UI_COLS (UI_LCD_WIDTH/UI_FONT_SMALL_WIDTH)
1305 #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
1306 #define UI_DISPLAY_CHARSET 3
1307 #define UI_INVERT_MENU_DIRECTION 0
1308 #undef UI_ENCODER_SPEED
1309 #define UI_ENCODER_SPEED 2
1310 #define SDCARDDETECT -1
1311 #define UI_DISPLAY_RW_PIN -1
1312 #define UI_ROTATE_180
1313 
1314 #define BEEPER_TYPE 1
1315 
1316 // SCK Pin: UI_DISPLAY_D4_PIN
1317 // Mosi Pin: UI_DISPLAY_ENABLE_PIN
1318 // CD Pin: UI_DISPLAY_RS_PIN
1319 
1320 #if MOTHERBOARD == 33 // RAMPS
1321 
1322 #define SDCARDDETECT 49 // sd card detect as shown on drawing
1323 #undef BEEPER_PIN
1324 #define BEEPER_PIN 35
1325 // Display A0
1326 #define UI_DISPLAY_D5_PIN 47
1327 // Display CS
1328 #define UI_DISPLAY_RS_PIN 32
1329 #define UI_ENCODER_A 45
1330 #define UI_ENCODER_B 41
1331 #define UI_ENCODER_CLICK 43
1332 #define UI_RESET_PIN -1
1333 #define RED_BLUE_STATUS_LEDS
1334 #define RED_STATUS_LED 39
1335 #define BLUE_STATUS_LED 37
1336 #elif MOTHERBOARD == 34 // Azteeg X3
1337 
1338 #define SDCARDDETECT 49 // sd card detect as shown on drawing
1339 #undef BEEPER_PIN
1340 #define BEEPER_PIN 33
1341 // Display A0
1342 #define UI_DISPLAY_D5_PIN 31
1343 // Display CS
1344 #define UI_DISPLAY_RS_PIN 32
1345 #define UI_ENCODER_A 22
1346 #define UI_ENCODER_B 7
1347 #define UI_ENCODER_CLICK 12
1348 #define UI_RESET_PIN -1
1349 #define RED_BLUE_STATUS_LEDS
1350 #define RED_STATUS_LED 64
1351 #define BLUE_STATUS_LED 63
1352 
1353 #elif MOTHERBOARD == 35 // Azteeg X3 Pro
1354 
1355 #undef SDCARDDETECT
1356 // sd card detect as shown on drawing
1357 #define SDCARDDETECT 49
1358 #undef BEEPER_PIN
1359 // 33 is the on board beeper
1360 #define BEEPER_PIN 47
1361 // Display A0
1362 #define UI_DISPLAY_D5_PIN 44
1363 // Display CS
1364 #define UI_DISPLAY_RS_PIN 45
1365 #define UI_ENCODER_A 22
1366 #define UI_ENCODER_B 7
1367 #define UI_ENCODER_CLICK 39
1368 #define UI_RESET_PIN -1
1369 #define RED_BLUE_STATUS_LEDS
1370 #define RED_STATUS_LED 32
1371 #define BLUE_STATUS_LED 35
1372 
1373 #elif MOTHERBOARD == 301 // RAMBO
1374 
1375 #define SDCARDDETECT 72 // sd card detect as shown on drawing
1376 #undef BEEPER_PIN
1377 #define BEEPER_PIN 33
1378 // Display A0
1379 #define UI_DISPLAY_D5_PIN 70
1380 // Display CS
1381 #define UI_DISPLAY_RS_PIN 71
1382 #define UI_ENCODER_A 85
1383 #define UI_ENCODER_B 84
1384 #define UI_ENCODER_CLICK 83
1385 #define UI_RESET_PIN -1
1386 #define RED_BLUE_STATUS_LEDS
1387 #define RED_STATUS_LED 22
1388 #define BLUE_STATUS_LED 32
1389 
1390 #elif MOTHERBOARD == 9 || MOTHERBOARD == 92 // Printboard
1391 // sd card detect as shown on drawing
1392 #define SDCARDDETECT 72
1393 #define SDSS 45
1394 #undef BEEPER_PIN
1395 #define BEEPER_PIN 32
1396 // Display A0
1397 #define UI_DISPLAY_D5_PIN 42
1398 // Display CS
1399 #define UI_DISPLAY_RS_PIN 43
1400 #define UI_ENCODER_A 26
1401 #define UI_ENCODER_B 27
1402 #define UI_ENCODER_CLICK 47
1403 #define UI_RESET_PIN -1
1404 #define RED_BLUE_STATUS_LEDS
1405 #define RED_STATUS_LED 12
1406 #define BLUE_STATUS_LED 10
1407 
1408 #elif MOTHERBOARD == 402 // RADDS
1409 
1410 #undef SDCARDDETECT
1411 #define SDCARDDETECT 14 // sd card detect as shown on drawing
1412 //#undef SDSS
1413 //#define SDSS 4
1414 //#define SPI_PIN 87
1415 //#define SPI_CHAN 1
1416 /*#define SDSS 10
1417  #undef SPI_PIN
1418  #define SPI_PIN 77
1419  #undef SPI_CHAN
1420  #define SPI_CHAN 0
1421 
1422  #undef SDSUPPORT
1423  #define SDSUPPORT 0 // sd card does not work reliable due to spi sharing
1424 */
1425 
1426 #undef BEEPER_PIN
1427 #define BEEPER_PIN 41
1428 // Hardware SPI creates artifacts on display, so we use software SPI
1429 #undef U8GLIB_ST7565_NHD_C2832_HW_SPI
1430 #define U8GLIB_ST7565_NHD_C2832_SW_SPI
1431 // MOSI 43
1432 #define UI_DISPLAY_ENABLE_PIN 31
1433 //#define UI_DISPLAY_ENABLE_PIN 75
1434 //76 // SCK pin
1435 #define UI_DISPLAY_D4_PIN 33 //44
1436 // Display A0 => LCD RS
1437 #define UI_DISPLAY_D5_PIN 42
1438 // Display CS => CS0 //4 //10
1439 #define UI_DISPLAY_RS_PIN 35 //10
1440 #define UI_ENCODER_A 50
1441 #define UI_ENCODER_B 52
1442 #define UI_ENCODER_CLICK 48
1443 #define UI_RESET_PIN -1
1444 #define RED_BLUE_STATUS_LEDS
1445 // PWM2 Pin
1446 #define RED_STATUS_LED 6
1447 // PWM1 Pin
1448 #define BLUE_STATUS_LED 5
1449 
1450 #else
1451 #error No predefined Viki 2 mapping for your board available
1452 #endif
1453 
1454 #ifdef UI_MAIN
1455 void uiInitKeys() {
1456  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1457  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin
1458 #if UI_RESET_PIN > -1
1460 #endif
1461 }
1462 void uiCheckKeys(uint16_t &action) {
1465 #if UI_RESET_PIN > -1
1467 #endif
1468 }
1469 inline void uiCheckSlowEncoder() {}
1470 void uiCheckSlowKeys(uint16_t &action) {}
1471 #endif
1472 #endif // Controller VIKI 2
1473 
1474 #if FEATURE_CONTROLLER == CONTROLLER_AZSMZ_12864
1475 #define UI_HAS_KEYS 1
1476 #define UI_HAS_BACK_KEY 0
1477 #define UI_DISPLAY_TYPE DISPLAY_U8G
1478 //#define U8GLIB_ST7920
1479 //#define U8GLIB_ST7565_NHD_C2832_HW_SPI
1480 #define UI_LCD_WIDTH 128
1481 #define UI_LCD_HEIGHT 64
1482 //select font size
1483 #define UI_FONT_6X10 //default font
1484 #define UI_FONT_WIDTH 6
1485 #define UI_FONT_HEIGHT 10
1486 #define UI_FONT_SMALL_HEIGHT 7
1487 #define UI_FONT_DEFAULT repetier_6x10
1488 #define UI_FONT_SMALL repetier_5x7
1489 #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
1490 #undef UI_ANIMATION
1491 #define UI_ANIMATION 0 // Animations are too slow
1492 
1493 //calculate rows and cols available with current font
1494 #define UI_COLS (UI_LCD_WIDTH/UI_FONT_SMALL_WIDTH)
1495 #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
1496 #define UI_DISPLAY_CHARSET 3
1497 #define UI_INVERT_MENU_DIRECTION 0
1498 #undef UI_ENCODER_SPEED
1499 #define UI_ENCODER_SPEED 2
1500 //#define SDCARDDETECT -1
1501 //#define UI_DISPLAY_RW_PIN -1
1502 #define UI_ROTATE_180
1503 
1504 #define BEEPER_TYPE 1
1505 
1506 // SCK Pin: UI_DISPLAY_D4_PIN
1507 // Mosi Pin: UI_DISPLAY_ENABLE_PIN
1508 // CD Pin: UI_DISPLAY_RS_PIN
1509 
1510 #if MOTHERBOARD == 408 || MOTHERBOARD == 413 // SMART RAMPS
1511 
1512 #undef SDCARDDETECT
1513 #define SDCARDDETECT 49 // sd card detect as shown on drawing
1514 
1515 #undef BEEPER_PIN
1516 #define BEEPER_PIN 66
1517 // Hardware SPI creates artifacts on display, so we use software SPI
1518 #undef U8GLIB_ST7565_NHD_C2832_HW_SPI
1519 #define U8GLIB_ST7565_NHD_C2832_SW_SPI
1520 #define LCD_CONTRAST 62
1521 // MOSI 43
1522 #define UI_DISPLAY_ENABLE_PIN 51
1523 //76 // SCK pin
1524 #define UI_DISPLAY_D4_PIN 52 //44
1525 // Display A0 => LCD RS
1526 #define UI_DISPLAY_D5_PIN 59
1527 // Display CS => CS0 //4 //10
1528 #define UI_DISPLAY_RS_PIN 44 //10
1529 #define UI_ENCODER_A 58
1530 #define UI_ENCODER_B 40
1531 #define UI_ENCODER_CLICK 67
1532 #define UI_RESET_PIN 42
1533 #else
1534 #error No predefined AZSMZ_12864 mapping for your board available
1535 #endif
1536 
1537 #ifdef UI_MAIN
1538 void uiInitKeys() {
1539  UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A, UI_ENCODER_B); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
1540  UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK); // push button, connects gnd to pin
1541  #if UI_RESET_PIN > -1
1543  #endif
1544 }
1545 void uiCheckKeys(uint16_t &action) {
1548  #if UI_RESET_PIN > -1
1550  #endif
1551 }
1552 inline void uiCheckSlowEncoder() {}
1553 void uiCheckSlowKeys(uint16_t &action) {}
1554 #endif
1555 #endif // Controller AZSMZ_12864
1556 
1557 
1558 #if FEATURE_CONTROLLER == CONTROLLER_LCD_MP_PHARAOH_DUE
1559 #define UI_DISPLAY_TYPE 1
1560 #define UI_COLS 20
1561 #define UI_ROWS 4
1562 #define UI_HAS_KEYS 1
1563 #define UI_HAS_BACK_KEY 0
1564 #define UI_INVERT_MENU_DIRECTION 1
1565 #define UI_DISPLAY_CHARSET 1
1566 #define UI_DISPLAY_RS_PIN 42 // PINK.1, 88, D_RS
1567 #define UI_DISPLAY_RW_PIN -1
1568 #define UI_DISPLAY_ENABLE_PIN 43 // PINK.3, 86, D_E
1569 #define UI_DISPLAY_D0_PIN 44 // PINF.5, 92, D_D4
1570 #define UI_DISPLAY_D1_PIN 45 // PINK.2, 87, D_D5
1571 #define UI_DISPLAY_D2_PIN 46 // PINL.5, 40, D_D6
1572 #define UI_DISPLAY_D3_PIN 47 // PINK.4, 85, D_D7
1573 #define UI_DISPLAY_D4_PIN 44 // PINF.5, 92, D_D4
1574 #define UI_DISPLAY_D5_PIN 45 // PINK.2, 87, D_D5
1575 #define UI_DISPLAY_D6_PIN 46 // PINL.5, 40, D_D6
1576 #define UI_DISPLAY_D7_PIN 47 // PINK.4, 85, D_D7
1577 #define UI_DELAYPERCHAR 50
1578 
1579 #ifdef UI_MAIN
1580 void uiInitKeys() {
1581  UI_KEYS_INIT_BUTTON_LOW(33); // push button, connects gnd to pin
1587 }
1588 void uiCheckKeys(uint16_t &action) {
1589  UI_KEYS_BUTTON_LOW(33, UI_ACTION_OK); //35 push button, connects gnd to pin
1590  UI_KEYS_BUTTON_LOW(35, UI_ACTION_PREVIOUS); //34 push button, connects gnd to pin
1591  UI_KEYS_BUTTON_LOW(31, UI_ACTION_NEXT); //43 push button, connects gnd to pin
1592  UI_KEYS_BUTTON_LOW(29, UI_ACTION_BACK); //44 push button, connects gnd to pin
1593  UI_KEYS_BUTTON_LOW(37, UI_ACTION_MENU_SDCARD ); //33 push button, connects gnd to pin
1594  UI_KEYS_BUTTON_LOW(X_MIN_PIN, UI_ACTION_RESET /*UI_ACTION_PAUSE*/);
1595 }
1596 inline void uiCheckSlowEncoder() {}
1597 void uiCheckSlowKeys(uint16_t &action) {}
1598 
1599 #endif
1600 #endif // CONTROLLER_LCD_MP_PHARAOH_DUE
1601 
1602 #if FEATURE_CONTROLLER == CONTROLLER_ZONESTAR
1603 
1604 // Keypad
1605 #if !defined(ADC_KEYPAD_PIN) || (ADC_KEYPAD_PIN < 0)
1606 #error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h
1607 #endif
1608 
1609 // This must be defined in the Configuration.h since used in ADC tables
1610 //#define ADC_KEYPAD_PIN 1 // A1 (D30, analog numbering)
1611 
1612 // Display
1613 // Define UI_DISPLAY_TYPE = DISPLAY_SR with pins to override default settings
1614 // that work for original Zonestar hardware.
1615 // For instance:
1616 // #define UI_DISPLAY_TYPE DISPLAY_SR
1617 // #define UI_DISPLAY_DATA_PIN 29
1618 // #define UI_DISPLAY_CLOCK_PIN 28
1619 // #define UI_DISPLAY_ENABLE_PIN -1 // for 2-wire or pin number for 3-wire
1620 #undef UI_DISPLAY_TYPE
1621 #define UI_DISPLAY_TYPE DISPLAY_4BIT
1622 
1623 #if MOTHERBOARD == 39 // ZRIB
1624 #define BEEPER_TYPE 1
1625 #define UI_DISPLAY_RS_PIN 16
1626 #define UI_DISPLAY_RW_PIN -1
1627 #define UI_DISPLAY_ENABLE_PIN 17
1628 #define UI_DISPLAY_D4_PIN 23
1629 #define UI_DISPLAY_D5_PIN 25
1630 #define UI_DISPLAY_D6_PIN 27
1631 #define UI_DISPLAY_D7_PIN 29
1632 #define UI_RESET_PIN 41
1633 
1634 #elif MOTHERBOARD == 703 // MEGATRONICS 3
1635 
1636 #define UI_DISPLAY_RS_PIN 32
1637 #define UI_DISPLAY_RW_PIN -1
1638 #define UI_DISPLAY_ENABLE_PIN 31
1639 #define UI_DISPLAY_D4_PIN 14
1640 #define UI_DISPLAY_D5_PIN 30
1641 #define UI_DISPLAY_D6_PIN 39
1642 #define UI_DISPLAY_D7_PIN 15
1643 #define BEEPER_TYPE 1
1644 
1645 #elif MOTHERBOARD == 63 // Melzi
1646 
1647 #define UI_DISPLAY_ENABLE_PIN 29
1648 #define UI_DISPLAY_RS_PIN 28
1649 #define UI_DISPLAY_RW_PIN -1
1650 #define UI_DISPLAY_D4_PIN 10
1651 #define UI_DISPLAY_D5_PIN 11
1652 #define UI_DISPLAY_D6_PIN 16
1653 #define UI_DISPLAY_D7_PIN 17
1654 #else
1655 #error Unknown display - board combination. Please add your pin mapping in DisplayList.h
1656 #endif
1657 
1658 #define UI_DISPLAY_CHARSET 1
1659 #define UI_COLS 20
1660 #define UI_ROWS 4
1661 
1662 // UI
1663 #define UI_HAS_KEYS 1
1664 #define UI_HAS_BACK_KEY 1
1665 #define UI_DELAYPERCHAR 50
1666 #define UI_INVERT_MENU_DIRECTION 1
1667 
1668 // Opportunity to override the Enter key via Configuration.h
1669 // By default it duplicates the Right key, but could be set to
1670 // anything else, e.g. UI_ACTION_TOP_MENU.
1671 #ifndef ADC_KEYPAD_CENTER_ACTION
1672 #define ADC_KEYPAD_CENTER_ACTION UI_ACTION_OK
1673 #endif
1674 
1675 #ifdef UI_MAIN
1676 // Nothing to init since ADC is read in a loop if ADC_KEYPAD_PIN > -1
1677 inline void uiInitKeys() {}
1678 
1679 // Read and decode ADC keypad (fast reads)
1680 void uiCheckKeys(uint16_t &action) {
1681  struct {
1682  uint16_t min;
1683  uint16_t max;
1684  uint16_t action;
1685  } keys[] = {
1686  { 300, 500, UI_ACTION_BACK }, // Left
1687  { 570, 870, UI_ACTION_PREVIOUS }, // Up
1688  { 1150, 1450, ADC_KEYPAD_CENTER_ACTION }, // Center
1689  { 1900, 2200, UI_ACTION_OK }, // Right
1690  { 2670, 2870, UI_ACTION_NEXT } // Down
1691  };
1692  const uint8_t numOfKeys = sizeof(keys) / sizeof(keys[0]);
1693 
1694  extern volatile uint16_t osAnalogInputValues[ANALOG_INPUTS];
1695  uint16_t adc = osAnalogInputValues[KEYPAD_ANALOG_INDEX] >> (ANALOG_REDUCE_BITS);
1696  if (adc < 4000) {
1697  for (int8_t i = 0; i < numOfKeys; ++i) {
1698  if ((adc > keys[i].min) && (adc < keys[i].max)) {
1699  action = keys[i].action;
1700  return;
1701  }
1702  }
1703  }
1704 }
1705 
1706 // Read and decode ADC keypad (slow reads)
1707 inline void uiCheckSlowKeys(uint16_t &action) {}
1708 #endif // UI_MAIN
1709 
1710 #endif // CONTROLLER_ZONESTAR
1711 
1712 #ifndef UI_HAS_I2C_ENCODER
1713 #define UI_HAS_I2C_ENCODER 0
1714 #endif
1715 
1716 
1717 #if FEATURE_CONTROLLER != NO_CONTROLLER
1718 #if UI_ROWS==4
1719 #if UI_COLS==16
1720 #define UI_LINE_OFFSETS {0,0x40,0x10,0x50} // 4x16
1721 #elif UI_COLS==20
1722 //#define UI_LINE_OFFSETS {0,0x20,0x40,0x60} // 4x20 with KS0073
1723 #define UI_LINE_OFFSETS {0,0x40,0x14,0x54} // 4x20 with HD44780
1724 #else
1725 #if UI_DISPLAY_TYPE!=DISPLAY_GAMEDUINO2
1726 #error Unknown combination off rows/columns - define UI_LINE_OFFSETS manually.
1727 #else
1728 #define UI_LINE_OFFSETS {} // dummy never used
1729 #endif
1730 #endif
1731 #else
1732 #define UI_LINE_OFFSETS {0,0x40,0x10,0x50} // 2x16, 2x20, 2x24
1733 #endif
1734 #include "uilang.h"
1735 #endif
1736 
1737 #define UI_VERSION_STRING "Repetier " REPETIER_VERSION
1738 
1739 #ifdef UI_HAS_I2C_KEYS
1740 #define COMPILE_I2C_DRIVER
1741 #endif
1742 
1743 #if UI_DISPLAY_TYPE != NO_DISPLAY
1744 
1745 
1746 #if UI_DISPLAY_TYPE == DISPLAY_I2C
1747 #define COMPILE_I2C_DRIVER
1748 #endif
1749 
1750 #ifndef UI_TEMP_PRECISION
1751 #if UI_COLS>16
1752 #define UI_TEMP_PRECISION 1
1753 #else
1754 #define UI_TEMP_PRECISION 0
1755 #endif
1756 #endif
1757 
1758 #define UI_INITIALIZE uid.initialize();
1759 #define UI_FAST if((counterPeriodical & 3) == 3) {uid.fastAction();}
1760 #define UI_MEDIUM uid.mediumAction();
1761 #define UI_SLOW(allowMoves) uid.slowAction(allowMoves);
1762 #define UI_STATUS(status) uid.setStatusP(PSTR(status));
1763 #define UI_STATUS_F(status) uid.setStatusP(status);
1764 #define UI_STATUS_UPD(status) {uid.setStatusP(PSTR(status));uid.refreshPage();}
1765 #define UI_STATUS_UPD_F(status) {uid.setStatusP(status);uid.refreshPage();}
1766 #define UI_STATUS_RAM(status) uid.setStatus(status);
1767 #define UI_STATUS_UPD_RAM(status) {uid.setStatus(status);uid.refreshPage();}
1768 #define UI_ERROR(status) uid.setStatusP(PSTR(status),true);
1769 #define UI_ERROR_P(status) uid.setStatusP(status,true);
1770 #define UI_ERROR_UPD(status) {uid.setStatusP(PSTR(status),true);uid.refreshPage();}
1771 #define UI_ERROR_RAM(status) uid.setStatus(status,true);
1772 #define UI_ERROR_UPD_RAM(status) {uid.setStatus(status,true);uid.refreshPage();}
1773 //#define UI_ERROR(msg) {uid.errorMsg=(void*)PSTR(msg);pushMenu((void*)&ui_menu_error,true);}
1774 #define UI_CLEAR_STATUS {uid.statusMsg[0]=0;}
1775 #define UI_RESET_MENU {uid.menuLevel=0;uid.refreshPage();}
1776 #define UI_MESSAGE(menu) {uid.showMessage(menu);}
1777 #define UI_ACTION(ac) {uid.executeAction(ac,true);}
1778 #else
1779 #define UI_INITIALIZE {}
1780 #define UI_FAST {}
1781 #define UI_MEDIUM {}
1782 #define UI_SLOW(allowMoves) {}
1783 #define UI_STATUS(status) {}
1784 #define UI_STATUS_F(status) {}
1785 #define UI_STATUS_RAM(status) {}
1786 #define UI_STATUS_UPD(status) {}
1787 #define UI_STATUS_UPD_F(status) {}
1788 #define UI_STATUS_UPD_RAM(status) {}
1789 #define UI_CLEAR_STATUS {}
1790 #define UI_ERROR(msg) {}
1791 #define UI_ERROR_P(status) {}
1792 #define UI_ERROR_UPD(status) {}
1793 #define UI_ERROR_RAM(status) {}
1794 #define UI_ERROR_UPD_RAM(status) {}
1795 #define UI_RESET_MENU {}
1796 #define UI_MESSAGE(menu) {}
1797 #define UI_ACTION(ac)
1798 #endif // Display
1799 
1800 // Beeper methods
1801 #if BEEPER_TYPE==0 || FEATURE_BEEPER == 0
1802 #define BEEP_SHORT {}
1803 #define BEEP_LONG {}
1804 #else
1805 #define BEEP_SHORT beep(BEEPER_SHORT_SEQUENCE);
1806 #define BEEP_LONG beep(BEEPER_LONG_SEQUENCE);
1807 #endif
1808 
1809 
1810 extern void beep(uint8_t duration, uint8_t count);
1811 #if (defined(USER_KEY1_PIN) && USER_KEY1_PIN > -1 && defined(USER_KEY1_ACTION)) || (defined(USER_KEY2_PIN) && USER_KEY2_PIN > -1 && defined(USER_KEY2_ACTION)) || (defined(USER_KEY3_PIN) && USER_KEY3_PIN > -1 && defined(USER_KEY3_ACTION)) || (defined(USER_KEY4_PIN) && USER_KEY4_PIN > -1 && defined(USER_KEY4_ACTION))
1812 #define HAS_USER_KEYS
1813 static void ui_check_Ukeys(uint16_t &action) {
1814  #if defined(USER_KEY1_PIN) && USER_KEY1_PIN > -1 && defined(USER_KEY1_ACTION)
1816  #endif
1817  #if defined(USER_KEY2_PIN) && USER_KEY2_PIN > -1 && defined(USER_KEY2_ACTION)
1819  #endif
1820  #if defined(USER_KEY3_PIN) && USER_KEY3_PIN > -1 && defined(USER_KEY3_ACTION)
1822  #endif
1823  #if defined(USER_KEY4_PIN) && USER_KEY4_PIN > -1 && defined(USER_KEY4_ACTION)
1825  #endif
1826 }
1827 #endif
1828 
1829 
1830 #endif
#define USER_KEY3_PIN
Definition: DisplayList.h:1107
static void i2cStop(void)
Definition: HAL.cpp:459
#define UI_KEYS_I2C_BUTTON_LOW(pin, action_)
Definition: ui.h:411
#define UI_ACTION_RESET
Definition: ui.h:171
#define USER_KEY2_ACTION
Definition: DisplayList.h:1106
#define UI_SHIFT_OUT
Definition: DisplayList.h:578
#define READ(IO)
Read a pin wrapper.
Definition: fastio.h:46
#define UI_ACTION_HOME_ALL
Definition: ui.h:102
static uint8_t i2cReadNak(void)
Definition: HAL.cpp:506
void uiCheckSlowEncoder()
Definition: gameduino2.h:167
static void ui_check_Ukeys(uint16_t &action)
Definition: DisplayList.h:1813
#define UI_ACTION_X_DOWN
Definition: ui.h:65
void beep(uint8_t duration, uint8_t count)
Definition: ui.cpp:70
#define USER_KEY1_PIN
Definition: DisplayList.h:1103
#define UI_KEYS_INIT_BUTTON_LOW(pin)
Definition: ui.h:365
#define WRITE(IO, v)
Write to a pin wrapper.
Definition: fastio.h:48
#define ANALOG_INPUTS
number of analog input signals. Normally 1 for each temperature sensor
Definition: Repetier.h:546
#define UI_BUTTON_PREVIOUS
Definition: DisplayList.h:748
#define UI_KEYS_CLICKENCODER_LOW_REV(pinA, pinB)
Definition: ui.h:370
#define UI_ACTION_Z_DOWN
Definition: ui.h:69
#define UI_BUTTON_SD_PRINT
Definition: DisplayList.h:750
#define SET_OUTPUT(IO)
set pin as output wrapper
Definition: fastio.h:56
#define UI_KEYS_BUTTON_LOW(pin, action_)
Definition: ui.h:371
#define USER_KEY3_ACTION
Definition: DisplayList.h:1108
#define I2C_READ
Definition: HAL.h:144
#define UI_ACTION_MENU_POSITIONS
Definition: ui.h:282
#define USER_KEY2_PIN
Definition: DisplayList.h:1105
#define UI_BUTTON_NEXT
Definition: DisplayList.h:747
#define USER_KEY4_ACTION
Definition: DisplayList.h:1110
static void i2cWrite(uint8_t data)
Definition: HAL.cpp:475
void uiCheckSlowKeys(int &action)
Definition: gameduino2.h:168
#define UI_ACTION_NEXT
Definition: ui.h:61
#define UI_ACTION_MENU_QUICKSETTINGS
Definition: ui.h:280
#define UI_RESET_PIN
Definition: DisplayList.h:744
#define UI_ACTION_MENU_SDCARD
Definition: ui.h:279
#define UI_ACTION_Z_UP
Definition: ui.h:68
#define USER_KEY1_ACTION
Definition: DisplayList.h:1104
#define UI_BUTTON_BACK
Definition: DisplayList.h:749
static uint8_t i2cReadAck(void)
Definition: HAL.cpp:494
#define X_MIN_PIN
Definition: pins.h:3055
#define UI_DISPLAY_I2C_ADDRESS
Definition: DisplayList.h:963
#define UI_ACTION_BACK
Definition: ui.h:82
void uiCheckKeys(int &action)
Definition: gameduino2.h:166
#define ANALOG_REDUCE_BITS
Definition: HAL.h:135
#define UI_ACTION_KILL
Definition: ui.h:170
#define UI_KEYS_INIT_CLICKENCODER_LOW(pinA, pinB)
Definition: ui.h:364
#define UI_KEYS_CLICKENCODER_LOW(pinA, pinB)
Definition: ui.h:369
#define I2C_WRITE
Definition: HAL.h:146
#define UI_ACTION_Y_DOWN
Definition: ui.h:67
#define UI_ENCODER_A
Definition: DisplayList.h:1266
#define UI_BUTTON_OK
Definition: DisplayList.h:746
#define UI_KILL_PIN
Definition: DisplayList.h:1100
#define UI_SHIFT_LD
Definition: DisplayList.h:579
#define UI_SHIFT_CLK
Definition: DisplayList.h:580
volatile uint osAnalogInputValues[ANALOG_INPUTS]
Definition: Extruder.cpp:45
#define UI_ACTION_Y_UP
Definition: ui.h:66
#define UI_ENCODER_CLICK
Definition: DisplayList.h:1268
#define UI_ACTION_X_UP
Definition: ui.h:64
#define UI_ACTION_OK
Definition: ui.h:83
void uiInitKeys()
Definition: gameduino2.h:165
#define UI_ENCODER_B
Definition: DisplayList.h:1267
#define USER_KEY4_PIN
Definition: DisplayList.h:1109
#define UI_ACTION_EMERGENCY_STOP
Definition: ui.h:86
#define UI_ACTION_SD_PRINT
Definition: ui.h:94
static void i2cStartWait(uint8_t address)
Definition: HAL.cpp:415
#define SET_INPUT(IO)
set pin as input wrapper
Definition: fastio.h:54
#define ADC_KEYPAD_CENTER_ACTION
Definition: DisplayList.h:1672
#define UI_ACTION_PREVIOUS
Definition: ui.h:62